package com.zpark.entity.patients;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 患者用药记录表
 * @TableName western_medication
 */
@TableName(value ="western_medication")
@Data
public class WesternMedication implements Serializable {
    /**
     * 用药记录ID
     */
    @TableId(value = "medication_id", type = IdType.AUTO)
    private Long medicationId;

    /**
     * 患者ID
     */
    @TableField(value = "patient_id")
    private Long patientId;

    /**
     * 患者姓名
     */
    @TableField(value = "patient_name")
    private String patientName;

    /**
     * 药品名称
     */
    @TableField(value = "drug_name")
    private String drugName;

    /**
     * 药品类别(抗生素/降压药/降糖药等)
     */
    @TableField(value = "drug_category")
    private String drugCategory;

    /**
     * 剂量
     */
    @TableField(value = "dosage")
    private BigDecimal dosage;

    /**
     * 剂量单位(mg/g/ml等)
     */
    @TableField(value = "dosage_unit")
    private String dosageUnit;

    /**
     * 用药频率(每日1次/每日2次等)
     */
    @TableField(value = "frequency")
    private String frequency;

    /**
     * 给药途径(口服/静脉注射等)
     */
    @TableField(value = "administration_route")
    private String administrationRoute;

    /**
     * 开始用药日期
     */
    @TableField(value = "start_date")
    private Date startDate;

    /**
     * 结束用药日期(空表示长期用药)
     */
    @TableField(value = "end_date")
    private Date endDate;

    /**
     * 用药时间点(JSON数组格式)
     */
    @TableField(value = "medication_times")
    private Object medicationTimes;

    /**
     * 适应症/用途
     */
    @TableField(value = "indication")
    private String indication;

    /**
     * 状态(进行中/已完成/已取消)
     */
    @TableField(value = "status")
    private String status;

    /**
     * 用药注意事项
     */
    @TableField(value = "notes")
    private String notes;

    /**
     * 创建时间
     */
    @TableField(value = "created_at")
    private Date createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at")
    private Date updatedAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        WesternMedication other = (WesternMedication) that;
        return (this.getMedicationId() == null ? other.getMedicationId() == null : this.getMedicationId().equals(other.getMedicationId()))
            && (this.getPatientId() == null ? other.getPatientId() == null : this.getPatientId().equals(other.getPatientId()))
            && (this.getPatientName() == null ? other.getPatientName() == null : this.getPatientName().equals(other.getPatientName()))
            && (this.getDrugName() == null ? other.getDrugName() == null : this.getDrugName().equals(other.getDrugName()))
            && (this.getDrugCategory() == null ? other.getDrugCategory() == null : this.getDrugCategory().equals(other.getDrugCategory()))
            && (this.getDosage() == null ? other.getDosage() == null : this.getDosage().equals(other.getDosage()))
            && (this.getDosageUnit() == null ? other.getDosageUnit() == null : this.getDosageUnit().equals(other.getDosageUnit()))
            && (this.getFrequency() == null ? other.getFrequency() == null : this.getFrequency().equals(other.getFrequency()))
            && (this.getAdministrationRoute() == null ? other.getAdministrationRoute() == null : this.getAdministrationRoute().equals(other.getAdministrationRoute()))
            && (this.getStartDate() == null ? other.getStartDate() == null : this.getStartDate().equals(other.getStartDate()))
            && (this.getEndDate() == null ? other.getEndDate() == null : this.getEndDate().equals(other.getEndDate()))
            && (this.getMedicationTimes() == null ? other.getMedicationTimes() == null : this.getMedicationTimes().equals(other.getMedicationTimes()))
            && (this.getIndication() == null ? other.getIndication() == null : this.getIndication().equals(other.getIndication()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getNotes() == null ? other.getNotes() == null : this.getNotes().equals(other.getNotes()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getMedicationId() == null) ? 0 : getMedicationId().hashCode());
        result = prime * result + ((getPatientId() == null) ? 0 : getPatientId().hashCode());
        result = prime * result + ((getPatientName() == null) ? 0 : getPatientName().hashCode());
        result = prime * result + ((getDrugName() == null) ? 0 : getDrugName().hashCode());
        result = prime * result + ((getDrugCategory() == null) ? 0 : getDrugCategory().hashCode());
        result = prime * result + ((getDosage() == null) ? 0 : getDosage().hashCode());
        result = prime * result + ((getDosageUnit() == null) ? 0 : getDosageUnit().hashCode());
        result = prime * result + ((getFrequency() == null) ? 0 : getFrequency().hashCode());
        result = prime * result + ((getAdministrationRoute() == null) ? 0 : getAdministrationRoute().hashCode());
        result = prime * result + ((getStartDate() == null) ? 0 : getStartDate().hashCode());
        result = prime * result + ((getEndDate() == null) ? 0 : getEndDate().hashCode());
        result = prime * result + ((getMedicationTimes() == null) ? 0 : getMedicationTimes().hashCode());
        result = prime * result + ((getIndication() == null) ? 0 : getIndication().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getNotes() == null) ? 0 : getNotes().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", medicationId=").append(medicationId);
        sb.append(", patientId=").append(patientId);
        sb.append(", patientName=").append(patientName);
        sb.append(", drugName=").append(drugName);
        sb.append(", drugCategory=").append(drugCategory);
        sb.append(", dosage=").append(dosage);
        sb.append(", dosageUnit=").append(dosageUnit);
        sb.append(", frequency=").append(frequency);
        sb.append(", administrationRoute=").append(administrationRoute);
        sb.append(", startDate=").append(startDate);
        sb.append(", endDate=").append(endDate);
        sb.append(", medicationTimes=").append(medicationTimes);
        sb.append(", indication=").append(indication);
        sb.append(", status=").append(status);
        sb.append(", notes=").append(notes);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}